package com.rockcent.helper;

import com.rockcent.common.common.BusinessException;
import com.rockcent.mall.lib.domain.enumclass.FundTransactionFlow;
import com.rockcent.mall.lib.domain.enumclass.MerchantFundFlowTransactionType;

/**
 *
 *
 * Created by zhangjh on 2017/3/30.
 */
public enum MerchantFundFlowHelper {
    SINGLETON;


    /**
     *
     * @param merchantId
     * @param mallId
     * @param transactionType
     * @param transactionFlow
     */
    public void validateFundFlow(Long merchantId, Long mallId, MerchantFundFlowTransactionType transactionType, FundTransactionFlow transactionFlow) {
        if (null == merchantId) {
            throw new BusinessException("商户id为空");
        }

        if (null == mallId) {
            throw new BusinessException("商户id为空");
        }


        if (null == transactionType) {
            throw new BusinessException("交易类型为空");
        }

        if (MerchantFundFlowTransactionType.ALL == transactionType) {
            throw new BusinessException("交易类型错误");
        }

        if (null == transactionFlow) {
            throw new BusinessException("交易方向为空");
        }


        if (FundTransactionFlow.ALL == transactionFlow) {
            throw new BusinessException("交易方向错误");
        }
    }
}
